package org.huawei260.String;

/**
 * @Auther: qingle
 * @Date: 2024/8/24-21:55
 * @Description:
 * @version: 1.0
 */

import java.util.HashMap;
import java.util.Map;

public class MapExample {
	public static void main(String[] args) {
		// 创建一个 HashMap 并添加一些数据
		Map<String, Integer> map = new HashMap<>();
		map.put("one", 1);
		map.put("two", 2);
		map.put("three", 3);

		// 使用 for-each 循环遍历 HashMap
		for (Map.Entry<String, Integer> entry : map.entrySet()) {
			System.out.println("Key: " + entry.getKey() + ", Value: " + entry.getValue());
		}

		for(Map.Entry<String, Integer> entry: map.entrySet()) {
			System.out.println("Key: " + entry.getKey() + ", Value:" + entry.getValue());
		}
	}
}